//
//  RegisterTeamViewController.m
//  bitcoin
//
//  Created by caiyajun on 2018/5/7.
//  Copyright © 2018年 比特币. All rights reserved.
//

#import "RegisterTeamViewController.h"
#import "RegisterViewController.h"
#import "EmailRegisterViewController.h"
#import "Masonry.h"
#define WIDTH ([UIScreen  mainScreen].bounds.size.width)
@interface RegisterTeamViewController ()<VTMagicViewDataSource,VTMagicViewDelegate>
@property (nonatomic, strong) NSMutableArray *menuList;
@property (nonatomic, strong) NSMutableArray *customerControllerArray;
@end

@implementation RegisterTeamViewController
-(NSMutableArray *)menuList{
    if(_menuList== nil){
        _menuList= [NSMutableArray array];
    }
    return _menuList;
}
-(NSMutableArray *)customerControllerArray{
    if(_customerControllerArray== nil){
        _customerControllerArray= [NSMutableArray array];
    }
    return _customerControllerArray;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    UIBarButtonItem *back = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"arrowleft-icon"] style:UIBarButtonItemStylePlain target:self action:@selector(backAction:)];
    self.navigationItem.leftBarButtonItem = back;
    [self addView];
    // Do any additional setup after loading the view.
}
- (void)backAction:(UIBarButtonItem *)sender {
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)addView{
    UIStoryboard *story = [UIStoryboard storyboardWithName:@"Login" bundle:nil];
    RegisterViewController *team = [story instantiateViewControllerWithIdentifier:@"RegisterViewController"];
    EmailRegisterViewController *team1 = [story instantiateViewControllerWithIdentifier:@"EmailRegisterViewController"];
    
    [self.customerControllerArray addObject:team];
    [self.customerControllerArray addObject:team1];
    
    [self.menuList addObject:@"手机注册"];
    [self.menuList addObject:@"邮箱注册"];
    
    self.magicView.dataSource = self;
    self.magicView.delegate = self;
    [self.magicView reloadData];
    self.edgesForExtendedLayout = UIRectEdgeAll;
    //    self.view.backgroundColor = [UIColor clearColor];
    self.magicView.navigationColor = RGBCOLOR(28, 32, 53);
    self.magicView.sliderColor = RGBCOLOR(123, 78, 225);
    self.magicView.sliderHeight=1;
    
    self.magicView.layoutStyle = VTLayoutStyleDivide;
    self.magicView.switchStyle = VTSwitchEventLoad;
    self.magicView.navigationHeight = 56;
    self.magicView.againstStatusBar = NO;
    self.magicView.needPreloading = NO;
    //    [self integrateComponents];
    [self.magicView setHeaderHidden:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (NSArray<NSString *> *)menuTitlesForMagicView:(VTMagicView *)magicView {
    return _menuList;
}

- (UIButton *)magicView:(VTMagicView *)magicView menuItemAtIndex:(NSUInteger)itemIndex
{
    static NSString *itemIdentifier = @"itemIdentifier";
    UIButton *menuItem = [magicView dequeueReusableItemWithIdentifier:itemIdentifier];
    if (!menuItem) {
        menuItem = [UIButton buttonWithType:UIButtonTypeCustom];
        [menuItem setTitleColor:RGBCOLOR(153, 153, 153) forState:UIControlStateNormal];
        [menuItem setTitleColor:RGBCOLOR(123, 78, 225) forState:UIControlStateSelected];
        menuItem.titleLabel.font = [UIFont fontWithName:@"Helvetica" size:18.f];
    }
    return menuItem;
}
- (UIViewController *)magicView:(VTMagicView *)magicView viewControllerAtPage:(NSUInteger)pageIndex {
    if (pageIndex==0) {
        RegisterViewController *team  = self.customerControllerArray[pageIndex];
        
        return team;
    }
    EmailRegisterViewController *team1  = self.customerControllerArray[pageIndex];
    
    return team1;
    
    
    
}


@end
